#include "Card.h"
#include <gtest/gtest.h>

class CardTest : public testing::Test
{
protected:
    virtual void SetUp() {
        card1.setCard(1);
        card2.setCard(2);
    }

    Card card1;
    Card card2;
};

TEST(Card, CardNum_1)
{
    Card card(1);
    ASSERT_TRUE(card.getSuit() == Card::SPADES);
    ASSERT_TRUE(card.getValue() == 11);
    ASSERT_TRUE(card.getNumber() == Card::ACE);
    ASSERT_TRUE(card.isAce());

    card.setCard(2);
    ASSERT_TRUE(card.getSuit() == Card::SPADES);
    ASSERT_TRUE(card.getValue() == 2);
    ASSERT_TRUE(card.getNumber() == Card::TWO);
    ASSERT_TRUE(!card.isAce());
}

TEST(Card, CardNum_2)
{
    Card card(2);
    ASSERT_TRUE(card.getSuit() == Card::SPADES);
    ASSERT_TRUE(card.getValue() == 2);
    ASSERT_TRUE(card.getNumber() == Card::TWO);
    ASSERT_TRUE(!card.isAce());
}

TEST(Card, CardNum_13)
{
    Card card(13);
    ASSERT_TRUE(card.getSuit() == Card::SPADES);
    ASSERT_TRUE(card.getValue() == 10);
    ASSERT_TRUE(card.getNumber() == Card::KING);
    ASSERT_TRUE(!card.isAce());
}

TEST(Card, CardNum_14)
{
    Card card(14);
    ASSERT_TRUE(card.getSuit() == Card::HEARTS);
    ASSERT_TRUE(card.getValue() == 11);
    ASSERT_TRUE(card.getNumber() == Card::ACE);
    ASSERT_TRUE(card.isAce());
}

TEST(Card, CardNum_Joker)
{
    Card card(Card::JOKER);
    ASSERT_TRUE(card.getSuit() == Card::JOKER);
    ASSERT_TRUE(card.getValue() == Card::JOKER);
    ASSERT_TRUE(card.getNumber() == Card::JOKER);
    ASSERT_TRUE(!card.isAce());
}

TEST_F(CardTest, TestFixture)
{
    ASSERT_TRUE(card1.getSuit() == Card::SPADES);
    ASSERT_TRUE(card1.getValue() == 11);
    ASSERT_TRUE(card1.getNumber() == Card::ACE);
    ASSERT_TRUE(card1.isAce());

    ASSERT_TRUE(card2.getSuit() == Card::SPADES);
    ASSERT_TRUE(card2.getValue() == 2);
    ASSERT_TRUE(card2.getNumber() == Card::TWO);
    ASSERT_TRUE(!card2.isAce());
}


// TEST(Card, CardNum_invalid)
// {
//     Card card(-1);
//     ASSERT_TRUE(card.getSuit() == Card::JOKER);
//     ASSERT_TRUE(card.getValue() == Card::JOKER);
//     ASSERT_TRUE(card.getNumber() == Card::JOKER);
//     ASSERT_TRUE(!card.isAce());
// }

int main(int argc, char **argv)
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

